<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
 
    <title>Document</title>
</head>
<body>
    <script>
        //object.assign 合并，相同后者会覆盖前者
        const target ={a:1,b:2}
        const source ={ b:3 ,c:4}
        const merge = Object.assign(target,source)
        console.log(merge)

        //合并函数对象参数
        function request(obj){
            const defaultParams ={method:'get'}
            const target = Object.assign(defaultParams,obj)
            console.log(`向地址${target.url}发起一个${target.method}`)
        }
        request({ url: 'http://134.23.42.1' })
      request({ url: 'http://134.23.42.1', method: 'post' })
    </script>
</body>
</html>
